package com.zork.cmdb.webapi.domain.dto;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
@ConfigurationProperties(prefix="spring.access")
public class AccessDTO {

    private List<RuleList> ruleList;

    public List<RuleList> getRuleList() {
        return ruleList;
    }

    public void setRuleList(List<RuleList> ruleList) {
        this.ruleList = ruleList;
    }

    public static class RuleList{
        private String url;
        private Set<String> ip;
        private String startTime;
        private String endTime;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public Set<String> getIp() {
            return ip;
        }

        public void setIp(Set<String> ip) {
            this.ip = ip;
        }

        public String getStartTime() {
            return startTime;
        }

        public void setStartTime(String startTime) {
            this.startTime = startTime;
        }

        public String getEndTime() {
            return endTime;
        }

        public void setEndTime(String endTime) {
            this.endTime = endTime;
        }

        @Override
        public String toString() {
            return "RuleList{" +
                    "url='" + url + '\'' +
                    ", ip=" + ip +
                    ", startTime='" + startTime + '\'' +
                    ", endTime='" + endTime + '\'' +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "AccessDTO{" +
                "ruleList=" + ruleList.toString() +
                '}';
    }
}
